﻿{% extends "gma/base.html" %}
{% load mytag %}

<!-- CONTENT
  =====================================================================-->

{% block content %}

<div class="page__hd">
    <h1 class="page__title">
        <i class="fa fa-camera-retro weui_grid_icon_fa" style="font-size: 32px;"> </i> 主播动态审核
    </h1>
    <p class="page__desc">  </p>
</div>

<div class="page__bd">
    <div class="weui-cells__title">主播</div>
    <div class="weui-cells">
        <a class="weui-cell weui-cell_access" href="{% url 'gma:caster_detail' user.uid %}">
            <div class="weui-cell__bd"> <p>[{{ user.id }}] {{ user.auth_nickname }}</p> </div>
            <div class="weui-cell__ft"> <img src="{{ user.avatar|cdn }}" class="right_large_avatar"> </div>
        </a>
    </div>

    <div class="weui-cells__title">动态</div>
    <div class="weui-cells weui-cells_form">
         <div class="weui-cell">
            <div class="weui-cell__bd"> <p>标题</p> </div>
            <div class="weui-cell__ft">{{ moment.title }}</div>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__hd">
                        <p class="weui-uploader__title">资源</p>
                        <div class="weui-uploader__info">{{ resources|length }}</div>
                    </div>
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles2">
                            {% for res in resources %}
                            <li class="weui-uploader__file" style="background-image:url({{ res.resource_url|cdn }})"></li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="weui-btn-area">
    {% if moment.auth_status == 1 %}
        <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:agree()">允许发布</a>
        <a class="weui-btn weui-btn_block weui-btn_warn" href="javascript:reject()">拒绝发布</a>
    {% elif moment.auth_status == 2 %}
        <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:agree()">允许发布</a>
    {% elif moment.auth_status == 3 %}
        <a class="weui-btn weui-btn_block weui-btn_warn" href="javascript:reject()">撤销发布</a>
    {% else %}
    {% endif %}
</div>

<div class="page__ft">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>

{% endblock content %}


<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}

<script>
function agree() {
    let url = "{% url 'gma:api_agree_moment' %}";
    let data = {
        'moment_id': {{ moment.id }},
    };

    new my_ajax(url, data, '', '', () => {
        show_toast("通过审核!");
        window.history.back();
    });
}

function reject() {
    let url = "{% url 'gma:api_reject_moment' %}";
    let data = {
        'moment_id': {{ moment.id }},
    };

    new my_ajax(url, data, '', '', () => {
        show_toast("拒绝审核!");
        window.history.back();
    });
}
</script>
{% endblock extra_js %}